package com.hengfoxwolf.jetpackdemo.ui.loading
import androidx.lifecycle.ViewModelProvider
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.navigation.NavOptions
import androidx.navigation.fragment.findNavController
import com.hengfoxwolf.jetpackdemo.R
import com.hengfoxwolf.jetpackdemo.base.BaseFragment
import com.hengfoxwolf.jetpackdemo.constants.StringConstant
import com.hengfoxwolf.jetpackdemo.databinding.FragmentLoadingBinding

class LoadingFragment : BaseFragment<FragmentLoadingBinding>(FragmentLoadingBinding::inflate) {

    private lateinit var viewModel: LoadingViewModel

    override fun onViewCreated(view: View, bundle: Bundle?) {

        super.onViewCreated(view, bundle)
        viewModel = ViewModelProvider(this)[LoadingViewModel::class.java]

        /*
        * 通过arguments获取传递的参数值
        * */
        val value = arguments?.getInt(StringConstant.PARAM_VALUE,0)
        Log.d(TAG, "value:${value}")
    }

    companion object {
        fun newInstance() = LoadingFragment()

        const val TAG = "LoadingFragment"
    }
}